package LeetCode.NumOffer;

public class NumOffer48 {
    public int lengthOfLongestSubstring(String s) {
        char []arr = s.toCharArray();
        if(arr.length == 0){
            return 0;
        }
        int maxLength = 0;
        int midLength = 1;
        int midArr = ' ';
        for (int i = 0; i < arr.length; i++) {
            for (int j = i; j < arr.length; j++) {
                if(midArr == arr[j]){
                    break;
                }
                if(arr[i] != arr[j]){
                    midArr = arr[j];
                    ++midLength;
                }else{
                    maxLength = Math.max(maxLength,midLength);
                    midLength = 0;
                }
            }
        }
        return maxLength;
    }
}
